<template>
  <div>
    <div class="video-group" v-if="mobile === 'false' ? true : false">
      <div v-for="item of props.data" :key="item.id">
        <homeVideoItem
          :data="item"
          :type="props.type"
          :time="item.createTime"
          @cancel="cancel"
        ></homeVideoItem>
      </div>
    </div>
    <div v-else class="video-pc">
      <div v-for="item of props.data" :key="item.id">
        <homeVideoPc
          :data="item"
          :type="props.type"
          :time="item.createTime"
          @cancel="cancel"
        ></homeVideoPc>
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps, defineEmits } from "vue";
import homeVideoItem from "@/components/concern/like-collect-h5.vue";
import homeVideoPc from "@/components/concern/like-collect-pc.vue";

const emits = defineEmits(["cancel"]);
const props = defineProps({
  data: {
    type: Array,
    default: () => [],
  },
  type: {
    type: Number,
    default: 3,
  },
});

const cancel = (id, type) => {
  emits("cancel", id, type);
};

const mobile = localStorage.getItem("mobile");
</script>

<style scoped lang="scss">
@mixin group-video($group, $gapWidth) {
  display: grid;
  grid-template-columns: repeat($group, 1fr);
  grid-gap: $gapWidth;
  align-items: center;
  justify-content: center;
}

.video-group {
  @include group-video(2, 10px);
}

.demonstration {
  color: var(--el-text-color-secondary);
}

.el-carousel__item h3 {
  color: #475669;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
  text-align: center;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}

.video-pc {
  @include group-video(5, 20px);
}
</style>
